<?php
/**
 * 注意：本内容仅限于博也公司内部传阅,禁止外泄以及用于其他的商业目的
 * @author    hebidu<346551990@qq.com>
 * @copyright 2017 www.itboye.com Boye Inc. All rights reserved.
 * @link      http://www.itboye.com/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 * Revision History Version
 ********1.0.0********************
 * file created @ 2017-11-13 15:17
 *********************************
 ********1.0.1********************
 *
 *********************************
 */

namespace app\src\sunsun\common\helper;


class DeviceTypeHelper
{
    // 【S01: 过滤桶】 【S02:加热棒】 【S03:森森806】 【S04:APH-300】 【S05:变频水泵】 【S06:ADT】
    // 【S07: CP1000水泵】
    const Did_AQ500 = 'S035';
    const Did_FilterVat = 'S01';
    const Did_HeatingRod = 'S02';
    const Did_AQ806 = 'S03';
    const Did_APH300 = 'S04';
    const Did_WaterPump = 'S05';
    const Did_ADT = 'S06';
    const Did_CP1000 = 'S07';
    const Did_Unknown = 'XXX';

    public static function getDeviceType($did)
    {
        $type = strtoupper(substr($did, 0, 3));
        $secondType = strtoupper(substr($did, 0, 4));
        switch ($type) {
            case DeviceTypeHelper::Did_FilterVat:
                return DeviceTypeHelper::Did_FilterVat;
                break;
            case DeviceTypeHelper::Did_WaterPump:
                return DeviceTypeHelper::Did_WaterPump;
                break;
            case DeviceTypeHelper::Did_ADT:
                return DeviceTypeHelper::Did_ADT;
                break;
            case DeviceTypeHelper::Did_HeatingRod:
                return DeviceTypeHelper::Did_HeatingRod;
                break;
            case DeviceTypeHelper::Did_AQ806:
                if ($secondType == DeviceTypeHelper::Did_AQ500) {
                    return DeviceTypeHelper::Did_AQ500;
                }
                return DeviceTypeHelper::Did_AQ806;
                break;
            case DeviceTypeHelper::Did_APH300:
                return DeviceTypeHelper::Did_APH300;
                break;
            case DeviceTypeHelper::Did_CP1000:
                return DeviceTypeHelper::Did_CP1000;
                break;
            default:
                return DeviceTypeHelper::Did_Unknown;
                break;

        }

    }


}